﻿@model UserModel

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">编辑我的资料</div>
                <div class="layui-card-body" pad15>

                    <div class="layui-form" lay-filter="layuiadmin-form-user" id="layuiadmin-form-user" style="padding: 20px 30px 0 0;">
                        <input asp-for="Id" type="hidden" />
                        <input asp-for="UserGuid" type="hidden" />
                        <input asp-for="Code" type="hidden" />
                        <div class="layui-form-item">
                            <u-label asp-for="Nickname" />
                            <div class="layui-input-inline">
                                <u-editor asp-for="Nickname" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="Phone" />
                            <div class="layui-input-inline">
                                <u-editor asp-for="Phone" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="Email" />
                            <div class="layui-input-inline">
                                <u-editor asp-for="Email" />
                            </div>
                            <div class="layui-form-mid layui-word-aux">不可修改。用于后台登入名</div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="Active" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="Active" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AdminComment" />
                            <div class="layui-input-block">
                                <u-textarea asp-for="AdminComment" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="set_system_submit_btn">确认保存</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['index', 'form'], function () {
        var $ = layui.$
            , form = layui.form;
        //监听提交
        form.on('submit(set_system_submit_btn)', function (data) {
            var field = data.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引

            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.post('@Url.Action("EditInfo")', field, function(rep) {
                parent.layui.table.reload('LAY-user-list'); //重载表格
                parent.layer.close(index); //再执行关闭
            });
        });
    })
</script>
